﻿using System;
using System.Collections.Generic;
using System.Linq;
using ProgramDioptase.Interfaces;

namespace ProgramDioptase
{
    public class PublishSubscribe
    {
        private readonly List<INotyfiable> subscribers;

        public PublishSubscribe()
        {
            this.subscribers = new List<INotyfiable>();
        }

        public void Subscribe(INotyfiable subscriber)
        {
            this.subscribers.Add(subscriber);
        }

        public void NewMovieGameMusic()
        {
            foreach (var subscriber in this.subscribers)
            {
                subscriber.Notify();
            }
        }
    }
}